<template>
	<view class="ordeform">
		<!-- <view class="header-top" style="height: 50rpx">

		</view>
		<view class="header-line" :style="{height:height+'px'}">

			<view class="left" @click="shang">
				<u-icon name="arrow-left" size="17" color="#fff"></u-icon>
			</view>
			<view class="right" style="text-align: center;">
				<view class="search">
					取消原因
				</view>
			</view>

		</view>
		<view class="box" :style="{height:'10'+'px'}">

		</view> -->
		<view class="cancellationoforder_box">
			<view class="cancellationoforder_box_top">
				<view class="cancellationoforder_box_top_a">
					<view class="cancellationoforder_box_top_shang">
						<text class="text1">订单状态：</text>
						<text class="text2" >待接单</text>
						

					</view>
				</view>
				<view class="quxiao">
					取消原因：
				</view>
				<view class="cancellationoforder_box_zhong">
					<view class="cancellationoforder_box_zhong_a">
						<radio-group class="radio-group" @change="radioChange">
							<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items"
								:key="item.value">
								<view class="view">
									<radio :value="String(item.id) " style="transform:scale(0.6)" />
								</view>
								<text>{{item.cancelReason}}</text>
							</label>
						</radio-group>

					</view>

				</view>
				<view class="tuikuang">
					<view class="tuikuang_box">
						<view class="jinge">退款金额：</view>
						<view class="qian">
							<text class="text1">￥</text>
							<text class="text2">{{obj.refundMoney}}</text>
						</view>
						<view class="shaoqian">
							不可修改，最少￥{{obj.refundMoney}}
						</view>
					</view>

				</view>
				<view class="wenben">
					<u--textarea v-model="message" :maxlength="100" :count="true" confirmType="done" />
				</view>
			</view>
			<view class="cancellationoforder_box_bottom" @click="ordeformsubmit">
				提交
			</view>

		</view>
	</view>
</template>

<script>
	import homeServices from '../../service/homeService'
	export default {
		data() {
			return {

				message: '',
				items: [

				],
				// current: 0,
				ids: '',
				ids2: '',
				cancelorderId: '',
				obj: {},
				status: ''

			}
		},
		
		methods: {
			async radioChange(e) {
				this.ids2 = e.detail.value
				let params = {
					reasonId: this.ids2,
					orderId: this.cancelorderId,
					cancelReason: this.message
				}
				let res = await homeServices.radioChange(params)
				this.obj = res.data
			},
			async getordeform() {
				let params = {
					oid: this.ids
				}
				let res = await homeServices.getordeform(params)
				this.items = res.data

			},
			completeInputMobile(e) {
				console.log(e)
				this.message = e.detail
				console.log(this.message)
			},
			async ordeformsubmit() {
				let params = {
					reasonId: this.ids2,
					orderId: this.cancelorderId,
					cancelReason: this.message
				}
				let res = await homeServices.ordeformsubmit(params)
				if (res.status == 200) {
					uni.showToast({
						title: '订单取消成功',
						icon: 'none'

					});

					setTimeout(function() {
						// uni.navigateTo({
						// 	url:'/pagesB/serviceorder/serviceorder'
						// })
						// uni.redirectTo({
						// 	url:'/pagesB/serviceorder/serviceorder?id='+1
						// })
						uni.navigateBack({})
						
					}, 1000);
				}


				console.log(res)
			},
			

		},
		onLoad(id) {
			// console.log(id.status,'qqqqqqqqqqq')
			this.status = id.status
			this.ids = id.id
			this.cancelorderId = id.cancelorderId
			console.log(this.ids, this.cancelorderId, '1111111111111111')
			this.getordeform()
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/static/sass/ordeform.scss'
</style>
